package com.school.movie.common.model;

import lombok.AllArgsConstructor;
import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

/**
 * @author zhaoren
 * @date 2020/07/06
 * Result Code Enum
 */
@Getter
@AllArgsConstructor
public enum ResultCode {

    REDIS_TOKEN_MISS(600, "Missing Token In Redis"),

    REDIS_TOKEN_ERROR(601, "Redis Token Match Error"),

    TOKEN_VERIFY_ERROR(602, "Token VERIFY Error"),

    TRANSACTION_ERROR(603, "Transaction Error"),

    RANDOM_NUMBER_ERROR(604, "Valid RandomNumber Error"),

    UPLOAD_FILE_ERROR(605, "Upload File Error"),

    USER_LOGIN_ERROR(606, "用户名或密码错误"),

    USER_HAS_EXITS_ERROR(607, "用户已存在"),

    SUCCESS(HttpServletResponse.SC_OK, "Operation is Successful"),

    FAILURE(HttpServletResponse.SC_BAD_REQUEST, "Biz Exception"),

    UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "Request Unauthorized"),

    NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 Not Found"),

    MSG_NOT_READABLE(HttpServletResponse.SC_BAD_REQUEST, "Message Can't be Read"),

    METHOD_NOT_SUPPORTED(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Method Not Supported"),

    MEDIA_TYPE_NOT_SUPPORTED(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "Media Type Not Supported"),

    REQ_REJECT(HttpServletResponse.SC_FORBIDDEN, "Request Rejected"),

    INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error"),

    PARAM_MISS(HttpServletResponse.SC_BAD_REQUEST, "Missing Required Parameter"),

    PARAM_TYPE_ERROR(HttpServletResponse.SC_BAD_REQUEST, "Parameter Type Mismatch"),

    PARAM_BIND_ERROR(HttpServletResponse.SC_BAD_REQUEST, "Parameter Binding Error"),

    PARAM_VALID_ERROR(HttpServletResponse.SC_BAD_REQUEST, "Parameter Validation Error"),

    /**
     * token过期
     * 错误码 5000 是基础平台定的
     */
    TOKEN_EXPIRED(5000, "身份信息已失效,请重新登录");

    final int code;

    final String msg;

}
